/**
 * @param {number[]} nums
 * @return {number}
 */
let nums = []
var majorityElement = function(nums) {
    const n = nums.length
    if (n === 0){
        return;
    }
    const map = new Map();
    for( let i of nums){
        map.set(i,(map.get(i)||0)+1)
        if(map.get(i) > n/2){
            return i
        }
    }
};

majorityElement(nums);